com.cete.dynamicpdf
Class Template



Example : This example shows how to create a template and add it to the document.
   import com.cete.dynamicpdf.*;
   import com.cete.dynamicpdf.pageelements.*;
 
   public class MyClass {
     public static void main(String args[]) {
         // Create a PDF Document
         Document document = new Document();
        
         // Add 5 blank pages to the document
         document.getPages().add( new Page( PageSize.LETTER ) );
         document.getPages().add( new Page( PageSize.LETTER ) );
         document.getPages().add( new Page( PageSize.LETTER ) );
         document.getPages().add( new Page( PageSize.LETTER ) );
         document.getPages().add( new Page( PageSize.LETTER ) );
        
         // Create an even odd template and add elements to it
         Template template = new Template();
         template.getElements().add( new Label( "Header", 0, 0, 200, 12 ) );
         template.getElements().add( new Label( "Footer", 0, 680, 200, 12 ) );
        
         // Add the template to the document
         document.setTemplate( template );
        
         // Save the PDF document
         document.draw( "[physicalpath]/MyDocument.pdf" );
      }
    }